package nowcoder;
/**
 * 完全数计算
 * 链接：https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84?tpId=37&&tqId=21279&rp=1&ru=/activity/oj&qru=/ta/huawei/question-ranking
 */
import java.util.*;
public class Day16_1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int count = 0;
        for (int i = 2; i <= n; i++) {
            if(isWanQuanNum(i)){
                count ++;
            }
        }
        System.out.println(count);
    }

    //检验一个数是否为完全数
    private static boolean isWanQuanNum(int n) {
        //如 28
        // 因子：1, 2, 4, 7, 14, 28
        // 1 + 2 + 4 + 7 + 14 = 28
        int sum = 0;
        for (int i = 1; i < n; i++) {
            if(n % i == 0){
                sum += i;
            }
        }
        return sum == n;
    }
}
